package com.by.auto;

import org.springframework.boot.context.properties.ConfigurationProperties;

@ConfigurationProperties(prefix = "token.interceptor")
public class TokenInterceptorProperties {

    private final String[] DEFAULT_PATH_PATTERN = {"/**"}; //默认拦截所有的请求
    private final String[] DEFAULT_EXCLUDE_PATH_PATTERN = {"/login"}; //默认不拦截所有的请求

    String[] pathPatterns; //拦截的路径
    String[] excludePathPatterns; //不拦截的路径

    public String[] getPathPatterns() {
        if(null == pathPatterns){
            //提供默认值
            return DEFAULT_PATH_PATTERN;
        }
        return pathPatterns;
    }

    public void setPathPatterns(String[] pathPatterns) {
        this.pathPatterns = pathPatterns;
    }

    public String[] getExcludePathPatterns() {
        if(null == excludePathPatterns){
            return DEFAULT_EXCLUDE_PATH_PATTERN;
        }
        return excludePathPatterns;
    }

    public void setExcludePathPatterns(String[] excludePathPatterns) {
        this.excludePathPatterns = excludePathPatterns;
    }
}
